package com.mybatis.demo.plugin;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 插件方式2
 */
public class MyProxy2 {

  public static void main(String[] args) {
    List<Interceptor> interceptors = new ArrayList<>();
    interceptors.add(new LogInterceptor());
    interceptors.add(new TransactionInterceptor());
    SayHello service = new SayHelloImpl();
    SayHello wrap = (SayHello) HWInvocationHandler.wrap(service, interceptors);
    wrap.sayHello();
  }

}
